// pages/myPink/myPink.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
  
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that=this;
    wx.getSystemInfo({
      success: function(res) {
        that.setData({
          winHeight:res.windowHeight
        })
      }
    })


    var pinks = wx.getStorageSync("pinkArr");
    if (pinks){
      for(var i=0;i<pinks.length;i++){
        if (pinks[i].id == 3) {
          pinks[i].pink="../../image/yhq1.png"
        } else if (pinks[i].id == 5) {
          pinks[i].pink = "../../image/jf10.png"
        } else if (pinks[i].id == 9) {
          pinks[i].pink = "../../image/yhq5.png"
        } else if (pinks[i].id == 11) {
          pinks[i].pink = "../../image/jf15.png"
        } else if (pinks[i].id == 13) {
          pinks[i].pink = "../../image/jf5.png"
        } else if (pinks[i].id == 15) {
          pinks[i].pink = "../../image/yhq5.png"
        }
      }
      this.setData({
        pinks: pinks
      })
    }
  },
  deletPink:function(e){
    var that = this;
    wx.showModal({
      title: '提示',
      content: '是否核销奖券',
      success:function(res){
        if(res.confirm){
          that.data.pinks.splice(e.target.id, 1);
          that.setData({
            pinks: that.data.pinks
          })
          wx.setStorageSync("pinkArr", that.data.pinks)
        }
      }
    })
  }
 ,
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})